package com.cy.model;

import com.cy.BasicModel;
import com.cy.ext.plugin.tablebind.TableBind;

import java.util.Date;

/**
 * 渠道商
 */
@TableBind(tableName="distributor",pkName = "id")
public class Distributor extends BasicModel<Distributor> {
    public static final Distributor dao = new Distributor();
    public static final String SELECT_ALL = "`id`,`name`,`contact`,`account_id`,`start_date`,`end_date`,`type`,`remark`";

    /**
     * 渠道商类型：顺序不能改
     */
    public enum Type{
        HOT_DRINKS("热饮渠道"),
        DEVICE("饮品机渠道");

        private String value;

        private Type(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }
            
    public Distributor setId(Long id){
        return this.set("id",id);
    }

    public Long getId(){
        return this.get("id");
    }
        
    public Distributor setName(String name){
        return this.set("name",name);
    }

    public String getName(){
        return this.getStr("name");
    }

    public Distributor setContact(String contact){
        return this.set("contact",contact);
    }

    public String getContact(){
        return this.getStr("contact");
    }

    public Distributor setAccountId(Long accountId){
        return this.set("account_id",accountId);
    }

    public Long getAccountId(){
        return this.get("account_id");
    }

    public Account getAccount(){
        return Account.dao.findById(getAccountId());
    }

    public Distributor setStartDate(Date startDate){
        return this.set("start_date",startDate);
    }

    public Date getStartDate(){
        return this.get("start_date");
    }

    public Distributor setEndDate(Date endDate){
        return this.set("end_date",endDate);
    }

    public Date getEndDate(){
        return this.get("end_date");
    }

    public Distributor setType(Integer type){
        return this.set("type",type);
    }

    public Integer getType(){
        return this.get("type");
    }

    public Distributor setRemark(String remark){
        return this.set("remark",remark);
    }

    public String getRemark(){
        return this.get("remark");
    }
}
